#ifndef MYUDPSERVER_H
#define MYUDPSERVER_H

#include <iostream>
#include "udp_server.h"
#include "hicore.h"
#include "hifastlog.h"
#include <string>
#include <string.h>
#include <sstream>
#include <vector>
#include<iconv.h>
#include "udp_client.h"
#include "mongoose.h"
#include "config.h"
#include "json.h"
#include "bison.hh"
#include <map>

#define UDPPORT 15801

/************error code********/
#define ERR_NO 0x00
#define ERR_NOT_CFG_URL 0x01  //neimeng.ini 文件中未配置对应url
#define ERR_NO_RECORD_SVR 0X02 //非编服务未响应


static int s_exit_flag;
static int s_show_headers;
static string http_res_data = "";
using namespace std;


class MyUdpServer:public UdpServer
{
public:
    MyUdpServer();
    ~MyUdpServer();
    static void ev_handler(struct mg_connection *nc, int ev, void *ev_data);
    void on_udp_msg(char* buf, int len, char* dst_ip);

protected:
    void get_record_state(char *buf, int len,char* dst_ip);
    void start_record(char* buf, int len,char* dst_ip);
    void stop_record(char* buf, int len,char* dst_ip);
    
private:
    struct mg_mgr mgr;
    map<unsigned int,string> map_filename;

};

#endif // MYUDPSERVER_H
